@extends('web.layouts.app')

@section('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/index.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/ucenter.css')}}">
@endsection

@section('content')
    <div class="uc-wrap swrap mt20">
        <div class="uc-side L">
            <div class="uc-nav">
                <ul>
                    @include('web.user_center.menu')
                </ul>
            </div>
        </div>
      <div class="uc-main uc-mainbg R">
        <h3 class="uc-main-title">客户管理</h3>
        <!--查询表单-->
        <div class="user-custom-search ml20">
            <form method="get" action="{{ action('UserCenter\AgentController@customerManagement',['menu'=>8]) }}') }}">
                <span>用户名：</span>
                <input name="username" value="{{ $query['username'] }}" type="text" class="txt">
                <span class="ml20">真实姓名：</span>
                <input name="name" value="{{ $query['name'] }}" type="text" class="txt">
                <span>直属经纪人：</span>
                <select name="invite_user" style="width:130px ;height: 30px;" >
                    <option value="">全部</option>
                    <option value="{{$invite_code}}" {{$query['invite_user']==$invite_code?'selected="selected"':''}}>自己</option>
                    @foreach($second_broker as $item)
                        <option value="{{$item->invite_code}}" {{$query['invite_user']==$item->invite_code?'selected="selected"':''}}>{{!empty($item->name)?$item->name:(!empty($item->phone_number)?$item->phone_number:$item->username)}}</option>
                        @endforeach
                </select>
                <input type="submit" class="btn" value="搜索">
                <!-- <a class="button ml20" href="#">投资人开户</a> -->
            </form>
        </div>
        <!--列表-->
        <div class="user-item-list">
            <ul class="data-list custom-list">
                <li class="th">
                    <div class="col-nackname">用户名</div>
                    <div class="col-name">真实姓名</div>
                    <div class="col-number">用户编号</div>
                    <div class="col-time">创建时间</div>
                    <div class="col-status">状态</div>
                    <div class="col-handle">操作</div>
                </li>
                @forelse($users as $u)
                    <li>
                        <div class="col-nackname">{{ $u->username??'--' }}</div>
                        <div class="col-name">{{ $u->name??'--' }}</div>
                        <div class="col-number">{{ $u->identity_id }}</div>
                        <div class="col-time">{{ $u->created_at }}</div>
                        <div class="col-status">
                            正常
                        </div>
                        <div class="col-handle"><a class="blue" href="{{ action('UserCenter\AgentController@customerInfo',['id' => $u->id,'menu' =>8]) }}">查看详情</a>&nbsp;|&nbsp;<a class="blue" href="{{ action('UserCenter\AgentController@customerInvestList',['id' => $u->id,'menu' =>8]) }}">投资记录</a> </div>
                    </li>
                @empty
                    <li>没有投资人用户</li>
                @endforelse
            </ul>
            <div class="uc-page-box text-right">
                {!! $links !!}
            </div>
        </div>

    </div>
</div>
@endsection

@section('scripts')
    <script src="{{ asset('resources/web/js/index.js') }}"></script>
@endsection